package com.rn.ddd.infrastructure.repository.impl;

import com.rn.ddd.domain.merchant.entity.Store;
import com.rn.ddd.domain.merchant.repository.StoreRepository;
import com.rn.ddd.infrastructure.base.BaseDataConverter;
import com.rn.ddd.infrastructure.repository.mapper.StoreMapper;
import com.rn.ddd.infrastructure.repository.po.StorePO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * TODO
 *
 * @author 然诺
 * @date 2021/8/15
 */
@Service
public class StoreRepositoryImpl implements StoreRepository {

    @Resource
    private StoreMapper storeMapper;

    @Override
    public List<Store> getStoresByMerchant(long merchantId) {
        List<StorePO> storePoList = storeMapper.selectByMerchantId(merchantId);
        return BaseDataConverter.convertAll(storePoList, Store.class);
    }

}
